// require what we need
var gulp = require('gulp'),
    proxy = require('http-proxy-middleware');
    connect = require('gulp-connect');
    livereload = require('gulp-livereload');
    less = require('gulp-less');


// 定义webserver任务
gulp.task('webserver', function() {
    connect.server({
        root: '',
        port: 8085,
        livereload: true
    });
});

//gulp-less
gulp.task('testLess', function () {
    gulp.src('src/app/views/*.less') //多个文件以数组形式传�
        .pipe(less())
        .pipe(gulp.dest('src/app/views/css')); //将会在src/css下生成index.css以及detail.css
});

//livi-reload
gulp.task('watch', function() {
  livereload.listen();
  gulp.watch('src/app/views/*.less', ['testLess'])
});

//默认任务
gulp.task('default', ['webserver', 'testLess', 'watch']);
